CoInduction in Coq

نویسنده

  • Yves Bertot
چکیده

When providing a collection of constructors to define an inductive type, we actually also define a dual operation: a destructor. This destructor is always defined using the same structure of pattern-matching, so that we have a tendency to forget that we do extend the “pattern-matching” capability with a new destructor at each definition. Constructors and destructors play a dual role in the definition of inductive types. Constructors produce elements of the inductive type, destructors consume elements of the inductive type. The inductive type itself is defined as the smallest collection of elements that is stable with respect to the constructors: it must contain all constants that are declared to be in the inductive type and all results of the constructors when the arguments of these constructors are already found to be in the inductive type. When considering structural recursion, recursive definitions are functions that consume elements of the inductive type. The discipline of structural recursion imposes that recursive calls consume data that is obtained through the destructor. The inductive type uses the constructors and destructors in a specific way. Co-inductive types are the types one obtains when using them in a dual fashion. A co-inductive type will appear as the largest collection of elements that is stable with respect to the destructor. It contains every object that can be destructed by pattern-matching. The duality goes on when considering the definition of recursive functions. Co-recursive functions are function that produce elements of the co-inductive type. The discipline of guarded co-recursion imposes that co-recursive calls produce data that is consumed by a constructor. The main practical consequence is that co-inductive types contain objects that look like infinite objects. This rough sketch is more of a philosophical nature. When looking at the details, there are some aspects of co-inductive types that are not so simple to derive from a mere reflection of what happens with inductive types. The possibility to have co-inductive types in theorem proving tools was studied by Coquand [7], Paulson [19], Leclerc and Paulin-Mohring [16], and Gimenez [13]. Most of these authors were inspired by Aczel [1]. The paper [2] provides a short presentation of terms and (possibly infinite) trees, mainly in set-theoretic terms; it also explains recursion and co-recursion. In this document, we only consider the use of co-inductive types as it is provided in Coq.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Coiterative Morphisms: Interactive Equational Reasoning for Bisimulation, using Coalgebras

We study several techniques for interactive equational reasoning with the bisimulation equivalence. Our work is based on a modular library, formalised in Coq , that axiomatises weakly final coalgebras and bisimulation. As a theory we derive some coalgebraic schemes and an associated coinduction principle. This will help in interactive proofs by coinduction, modular derivation of congruence and ...

متن کامل

Moessner's Theorem: An Exercise in Coinductive Reasoning in Coq

Moessner’s Theorem describes a construction of the sequence of powers (1, 2, 3, . . . ), by repeatedly dropping and summing elements from the sequence of positive natural numbers. The theorem was presented by Moessner in 1951 without a proof and later proved and generalized in several directions. More recently, a coinductive proof of the original theorem was given by Niqui and Rutten. We presen...

متن کامل

A Coinductive Animation of Turing Machines

We adopt corecursion and coinduction to formalize Turing Machines and their operational semantics in the proof assistant Coq. By combining the formal analysis of converging and diverging evaluations, our approach allows us to certify the implementation of the functions computed by concrete Turing Machines. Our effort may be seen as a first step towards the formal development of basic computabil...

متن کامل

Proving Equality between Streams

Infinite lists, or streams are often used in mathematical problems. We investigate three models to represent these streams in Coq, a proof assistant. For each of these models we investigate what it means for streams to be equal, and how we can prove these stream equalities. In the two most fruitful models we represent streams using a coinductive type, which means coinduction is crucial in our p...

متن کامل

Program Verification by Coinduction

We present a novel program verification approach based on coinduction, which takes as input an operational semantics. No intermediates like axiomatic semantics or verification condition generators are needed. Specifications can be written using any state predicates. We implement our approach in Coq, giving a certifying language-independent verification framework. Our proof system is implemented...

متن کامل

Programming and Reasoning with Infinite Structures Using Copatterns and Sized Types

Inductive data such as lists and trees is modeled category-theoretically as algebra where construction is the primary concept and elimination is obtained by initiality. In a more practical setting, functions are programmed by pattern matching on inductive data. Dually, coinductive structures such as streams and processes are modeled as coalgebras where destruction (or transition) is primary and...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • CoRR

دوره abs/cs/0603119  شماره 

صفحات  -

تاریخ انتشار 2005